/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bluepc
 */
@Entity
@Table(name = "TimeMeal")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TimeMeal.findAll", query = "SELECT t FROM TimeMeal t"),
    @NamedQuery(name = "TimeMeal.findByIdTime", query = "SELECT t FROM TimeMeal t WHERE t.idTime = :idTime"),
    @NamedQuery(name = "TimeMeal.findByTimeName", query = "SELECT t FROM TimeMeal t WHERE t.timeName = :timeName"),
    @NamedQuery(name = "TimeMeal.findByTimeStatus", query = "SELECT t FROM TimeMeal t WHERE t.timeStatus = :timeStatus")})
public class TimeMeal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer idTime;
    @Size(max = 50)
    @Column(name = "time_name")
    private String timeName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "time_status")
    private boolean timeStatus;
    @OneToMany(mappedBy = "idTime")
    private List<Tables> tablesList;
    @OneToMany(mappedBy = "idTime")
    private List<BookTable> bookTableList;

    public TimeMeal() {
    }

    public TimeMeal(Integer idTime) {
        this.idTime = idTime;
    }

    public TimeMeal(Integer idTime, boolean timeStatus) {
        this.idTime = idTime;
        this.timeStatus = timeStatus;
    }

    public Integer getIdTime() {
        return idTime;
    }

    public void setIdTime(Integer idTime) {
        this.idTime = idTime;
    }

    public String getTimeName() {
        return timeName;
    }

    public void setTimeName(String timeName) {
        this.timeName = timeName;
    }

    public boolean getTimeStatus() {
        return timeStatus;
    }

    public void setTimeStatus(boolean timeStatus) {
        this.timeStatus = timeStatus;
    }

    @XmlTransient
    public List<Tables> getTablesList() {
        return tablesList;
    }

    public void setTablesList(List<Tables> tablesList) {
        this.tablesList = tablesList;
    }

    @XmlTransient
    public List<BookTable> getBookTableList() {
        return bookTableList;
    }

    public void setBookTableList(List<BookTable> bookTableList) {
        this.bookTableList = bookTableList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTime != null ? idTime.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TimeMeal)) {
            return false;
        }
        TimeMeal other = (TimeMeal) object;
        if ((this.idTime == null && other.idTime != null) || (this.idTime != null && !this.idTime.equals(other.idTime))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.TimeMeal[ idTime=" + idTime + " ]";
    }
    
}
